
function setDataNonSac(){	
	Ext.getStore('AssetDataMaster.Category').load();
	Ext.getStore('AssetDataMaster.SubCategory').load();
	Ext.getStore('AssetDataMaster.Brand').load();
	Ext.getStore('AssetDataMaster.Type').load();
	
	Ext.Ajax.request({
	method: "GET",
	dataType: "json",
	url: "./Services/Asset/AssetNonSac?category="+category+"&assetID="+asset_id+"",
	async: false	,
	success: function(c) {	
		var jsonResults= $.parseJSON(c.responseText);
		data = jsonResults.item[0];
		Ext.getCmp('assetnonsacform').getForm().setValues(data);
		Ext.getCmp('siteidnonsac').setDisabled(true);
		Ext.getCmp('assetcategorynonsac').setDisabled(true);
		Ext.getCmp('categorydescnonsac').setDisabled(true);
	}
	});	 	
	

}

function inputDataNonSac(){	
	Ext.getCmp('assetnonsacform').getForm().submit({     
		waitMsg : 'Processing...',
		success: function(form, action) {
			Ext.Msg.alert('Submited', action.response.responseText);
	    },
	    failure: function(form, action) {
	        Ext.Msg.alert('Submited', action.response.responseText);

			Ext.getCmp('assetMainForm').removeAll(true);
			Ext.getCmp('assetMainForm').add({xtype: 'AssetNonSacGrid'});
			Ext.getCmp('assetMainForm').doLayout();
	    }
    });

}
				   

function filterGridNonSac( site_id,category){
	Ext.getStore('AssetDataMaster.AssetNonSac').removeAll();
	Ext.getStore('AssetDataMaster.AssetNonSac').getProxy().url = "./Services/Asset/AssetNonSac/List?siteID="+site_id+"&category="+category+"";
	Ext.getStore('AssetDataMaster.AssetNonSac').load();	 
}

function filterGridNonSacLogs( site_id,category){
	Ext.getStore('AssetDataMaster.AssetNonSacLogs').removeAll();
	Ext.getStore('AssetDataMaster.AssetNonSacLogs').getProxy().url = "./Services/Asset/AssetNonSacLogs/List?siteID="+site_id+"&category="+category+"";
	Ext.getStore('AssetDataMaster.AssetNonSacLogs').load();	 
}

function filterNonSacLogs( asset_id,category){
	Ext.getStore('AssetDataMaster.AssetNonSacLogs').removeAll();
	Ext.getStore('AssetDataMaster.AssetNonSacLogs').getProxy().url = "./Services/Asset/AssetNonSacLogs/?assetID="+asset_id+"&category="+category+"";
	Ext.getStore('AssetDataMaster.AssetNonSacLogs').load();	 
}

function searchGridNonSac(){
	var keywordNS = Ext.getCmp("keywordAssetNonSac").getValue();
	Ext.getStore('AssetDataMaster.AssetNonSac').removeAll();
	Ext.getStore('AssetDataMaster.AssetNonSac').getProxy().url = "./Services/Asset/AssetNonSac/List?siteID="+site_id+"&category="+category+"&keyword="+keywordNS+"";
	Ext.getStore('AssetDataMaster.AssetNonSac').load();	 
}

function refreshGridNonSac(){
	Ext.getCmp('keywordAssetNonSac').setValue("");
	searchGridNonSac();
}


